package com.gk.courses.dao.mock;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.gk.courses.dao.StudentDao;
import com.gk.courses.model.Course;
import com.gk.courses.model.Student;

public class StudentDaoMock implements StudentDao {

	@Override
	public Student findById(int studentId) {
		return storage.getStudent(studentId);
	}

	@Override
	public void create(Student student) {
		storage.setStudent(student);
	}
	
	@Override
	public void updateCompletedCourse(Course course, Student student) {
		storage.updateCompletedCourse(course, student);
	}

	@Override
	public List<Course> getCompletedCourses(Student student) {
		return storage.getCompletedCoursesFor(student.getId());
	}
	
	@Override
	public List<Course> getEnrolledCourses(Student student) {
		return storage.getEnrolledCoursesFor(student.getId());
	}
	
	//----------------------------- injections -----------------------------

	protected StorageMock storage;
	
	@Autowired
	public final void setStorageMock(StorageMock storage) {
		this.storage = storage;
	}
	
}